1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2       <tr align=center>
3         <td
class="title" width="100%">Tài li&#7879;u &#273;ính kèm : <a href="./?act=tailieu_m&page=<? echo $_REQUEST['page']; ?>"><font class="V10pt" color="#ffffff">Nh&#7853;p M&#7899;i</font></a>
4     </td>
5       </tr>
6     </table>
7 <?
8     
switch ($_GET['action'])
9     {
10         
case 'del' :
11             $id = $_GET[
'id'];
12             $sql=
"select * from tailieu where doc_files_id=$id limit 1";
13             $pro=mysql_fetch_assoc(mysql_query($sql,$con));
14             
if ($pro)
15             {
16                 $sql =
"delete from tailieu where doc_files_id='".$id."'";
17                 $result = mysql_query($sql,$con);
18                 
if ($result)
19                 {
20                     
if (file_exists($pro['doc_files_file'])) unlink($pro['doc_files_file']);
21                     echo
"<p align=center class='err'>&#272;ã xóa thành công</p>";
22                 }
23                     
else echo "<p align=center class='err'>Không th&#7875; xóa d&#7919; li&#7879;u</p>";
24             }
25             
break;
26     }
27 ?>
28
29 <?
30     
if (isset($_POST['ButDel'])) {
31         $cnt=
0;
32         
foreach ($_POST['chk'] as $id)
33         {
34             $sql=
"select * from tailieu where doc_files_id=$id limit 1";
35             $pro=mysql_fetch_assoc(mysql_query($sql,$con));
36             
if ($pro)
37             {
38                 @$result = mysql_query(
"delete from tailieu where doc_files_id='".$id."'",$con);
39                 
if ($result) {
40                     $cnt++;
41                     
if (file_exists($pro['doc_files_file'])) unlink($pro['doc_files_file']);
42                 }
43             }
44         }
45         echo
"<p align=center class='err'>&#272;ã xóa ".$cnt." ph&#7847;n t&#7917;</p>";
46     }
47 ?>
48
49 <?
50     $page = $_GET[
"page"];
51     
//$MAXPAGE=10;
52     $p=
0;
53     
if ($page!='') $p=$page;
54     $
where="1=1";
55     
if ($_REQUEST['cat']!='') $where="doc_files_categoriesid=".$_REQUEST['cat'];
56
57 ?>
58 <form method=
"POST" name="frmList" action="index.php">
59 <input type=
"hidden" name="act" value="tailieu">
60 <input type=hidden name=
"page" value="<? echo $page; ?>">
61 <?
62 function taotrang($total,$link,$nitem,$itemcurrent,$step=
10)
63 {
global $con;
64     $ret=
"";
65     
66     $param=
"";
67     $pages=count_page($total,$nitem);
68     
if ($itemcurrent>0) $ret.='<a title="&#272;&#7847;u tiên" href="'.$link.'0" class="lslink">[&lt;]</a> ';
69     
if ($itemcurrent>1) $ret.='<a title="V&#7873; tr&#432;&#7899;c" href="'.$link.($itemcurrent-1).'" class="lslink">[&lt;&lt;]</a> ';
70     $
from=($itemcurrent-$step>0?$itemcurrent-$step:0);
71     $to=($itemcurrent+$step<$pages?$itemcurrent+$step:$pages);
72     
for ($i=$from;$i<$to;$i++)
73     {
74         
if ($i!=$itemcurrent) $ret.='<a href="'.$link.$i.'" class="lslink">'.($i+1).'</a> ';
75         
else $ret.='<b>'.($i+1).'</b> ';
76     }
77     
if ($itemcurrent<$pages-2) $ret.='<a title="Ti&#7871;p theo" href="'.$link.($itemcurrent+1).'">[&gt;&gt;]</a> ';
78     
if ($itemcurrent<$pages-1) $ret.='<a title="Cu&#7889;i cùng" href="'.$link.($pages-1).'">[&gt;]</a>';
79     
return $ret;
80 }
81     $pageindex=taotrang(CountRecord(
"tailieu",$where),"./?act=tailieu&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
82 ?>
83
84 <table cellspacing=
"0" cellpadding="0" width="100%">
85 <?
if ($_REQUEST['code']==1) echo '<tr><td align="center" class="err" colspan="3">&#272;ã c&#7853;p nh&#7853;t thành công</td></tr>'; ?>
86 <tr>
87 <td
class="smallfont" >Trang : <? echo $pageindex; ?></td>
88 <td height=
"30" align="right" class="smallfont">
89     <
select size="1" name="ddCat" class="smallfont">
90 <?
91     $ms=GetListProduct();
92     echo
'<option value="">[T&#7845;t c&#7843;]</option>';
93     
foreach ($ms as $m)
94         
if ($m[0]!=$_REQUEST['cat'])
95             echo
'<option value="'.$m[0].'">'.$m[1].'</option>';
96         
else
97             echo
'<option selected value="'.$m[0].'">'.$m[1].'</option>';
98 ?>
99     </
select>
100     <input type=
"button" value="Chuy&#7875;n" class="button" onclick="window.location='./?act=tailieu&cat='+ddCat.value">
101     </td>
102 </tr>
103 </table>
104
105 <table border=
"1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
106   <tr>
107     <td align=center nowrap
class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
108     <td colspan=
"2" nowrap class="title">&nbsp;</td>
109     <td align=
"center" nowrap class="title"><b>Mã</b></td>
110     <td align=
"center" nowrap class="title"><b>Tên</b></td>
111     <td align=
"center" nowrap class="title"><b>File</b></td>
112     <td align=
"center" nowrap class="title"><b>Không hi&#7879;n</b></td>
113     <td align=
"center" nowrap class="title"><b>Thu&#7897;c danh m&#7909;c</b></td>
114     <td align=
"center" nowrap class="title"><b>Ngày</b></td>
115   </tr>
116   
117   <?php
118             $sql=
"select * from tailieu where $where order by doc_files_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
119             $result=mysql_query($sql,$con);
120             $i=
0;
121             
while(($row=mysql_fetch_array($result)))
122             {
123             $i++;
124             
if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
125   ?>
126   
127   <tr>
128     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
129     <input type=
"checkbox" name="chk[]" value="<? echo $row['doc_files_id']; ?>"></td>
130     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
131     <a href=
"./?act=tailieu_m&id=<? echo $row['doc_files_id']; ?>&page=<? echo $_REQUEST['page'];?>">
132     S&#
7917;a</a></td>
133     <td align=
"center" bgcolor="<? echo $color; ?>" class="smallfont">
134     <a onclick=
"return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" href="./?act=tailieu&page=<? echo $_REQUEST['page']; ?>&action=del&id=<? echo $row['doc_files_id']; ?>">xoá</a></td>
135     <td bgcolor=
"<? echo $color; ?>" align="left" align="left" class="smallfont"><? echo $row['doc_files_id']; ?>&nbsp;</td>
136     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['doc_files_name']; ?>&nbsp;</td>
137     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['doc_files_file']; ?>&nbsp;</td>
138     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['doc_files_status']; ?>&nbsp;</td>
139     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['doc_files_categoriesid']; ?>&nbsp;</td>
140     <td bgcolor=
"<? echo $color; ?>" class="smallfont"><? echo $row['doc_files_dateadded']; ?>&nbsp;</td>
141   </tr>
142   <?
143                 }
144   ?>
145 </table>
146 <input type=
"submit" value="Xóa Ch&#7885;n" name="ButDel" onclick="return confirm('B&#7841;n có ch&#7855;c ch&#7855;n mu&#7889;n xoá ?');" class="button">
147 </form>
148 <script language=
"JavaScript">
149 function chkallClick(o) {
150     
var form = document.frmList;
151     
for (var i = 0; i < form.elements.length; i++) {
152         
if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
153             form.elements[i].
checked = document.frmList.chkall.checked;
154         }
155     }
156 }
157 </script>



Full source code website bán hàng thương mại điện tử gần giống shopee 468.831 lượt xem

Gõ tìm kiếm nhanh...